package com.sz.biz.logistics.base.service.impl;

import com.sz.biz.logistics.base.entity.ShippingLineDetail;
import com.sz.biz.logistics.base.service.ShippingLineDetailService;
import com.sz.biz.logistics.base.dto.ShippingLineDetailDto;
import com.sz.common.base.service.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Function: ShippingLineDetailService <br>
 * Author: wentao.chang <br>
 * Date: 2017-08-21 15:47:00
 */
@Service("shippingLineDetailService")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ShippingLineDetailServiceImpl extends AbstractService implements ShippingLineDetailService {
    @Override
    public void save(List<ShippingLineDetailDto> flightDetailDto) {
        dao.batchInsert("ShippingLineDetailMapper.insert",flightDetailDto);
    }

    /**
     * 根据shippingLineId删除明细
     *
     * @param shippingLineId shippingLineId
     */
    @Override
    public void deleteByShippingLineId(Integer shippingLineId) {
        dao.delete("ShippingLineDetailMapper.deleteByShippingLineId",shippingLineId);
    }

    /**
     * 根据id查询轮班信息
     *
     * @param shippingLineId shippingLineId
     * @return ShippingLineDto
     */
    @Override
    public List<ShippingLineDetail> findByShippingLineId(Integer shippingLineId) {
        return dao.findForList("ShippingLineDetailMapper.selectByShippingLineId",shippingLineId,ShippingLineDetail.class) ;
    }
}
